<template>
    <div>
        <div>新增权限信息</div>
        <div>
            <div>
      <h3>新增权限信息</h3>
    </div>
    <div class="shuchu1">
      权限名称:
      <el-input
        v-model="permission_name"
        placeholder="请输入内容"
        style="width: 230px"
      ></el-input>
    </div>
    <div class="shuchu1">
      权限等级:
      <el-input
        v-model="permission_level"
        placeholder="请输入内容"
        style="width: 230px"
      ></el-input>
    </div>
    <div class="shuchu1">
      权限路由:
      <el-input
        v-model="permission_url"
        placeholder="请输入内容"
        style="width: 230px"
      ></el-input>
    </div>
    <div>
      备&emsp;&emsp;注:
      <el-input
        type="textarea"
        :rows="2"
        placeholder="请输入内容"
        v-model="beizhu"
        style="width: 230px"
        class="wenbenyu"
      >
      </el-input>
    </div>
    <div class="role1">角色权限:
      <el-select v-model="value" placeholder="请选择">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
          style="width:230px"
        >
        </el-option>
      </el-select>
    </div>
    <div class="but1">
      <el-button type="success" @click="creprem">确定</el-button>
      <el-button @click="fanhui" type="info">返回</el-button>
    </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'createpermission',
    data() {
        return {
            permission_name: "",
            permission_level:'',
            permission_url:'',
      biezhu: "",
      options: [{
          value: '选项1',
          label: '"0",普通权限'
        }, {
          value: '选项2',
          label: '"1",管理员权限'
        }, {
          value: '选项3',
          label: '"2",最高级权限'
        },],
        value: ''
        };
    },
    props: {},

    components: {},

    created() {},

    mounted() {},

    methods: {
        creprem(){
            this.axios.post('http://127.0.0.1:8000/rbac/v1/createpermission/',{
                permission_name:this.permission_name,
                permission_level:this.permission_level,
                permission_url:this.permission_url,
                biezhu:this.biezhu,
            }).then(res=>{
                if (res.data.code == 200) {
                    alert('添加成功')
                    console.log(res);
                }
            }).catch(err=>{
                console.log(err);
                alert('添加失败~！,请联系相关技术人员')
            })
        }
    },

    computed: {},

    watch: {},

    directives: {},

    filters: {}
};
</script>

<style scoped >
.wenbenyu {
  padding-top: 5%;
}
.shuchu1 {
  padding-top: 5%;
}
.but1 {
  padding-top: 2%;
}
.role1{
    padding-top: 3%;
}
</style>
